<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm',array('focus'=>array($model,'title'))); ?>

    <p class="note"><?php echo Yii::t('site','Fields with {marker} are required.',array('{marker}'=>'<span class="required">*</span>')); ?></p>
    
    <?php echo CHtml::errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model,'title'); ?>
        <?php echo $form->textField($model,'title',array('size'=>80,'maxlength'=>128,'class'=>'large')); ?>
        <?php echo $form->error($model,'title'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'wikiBookId'); ?>
        <?php echo $form->dropDownList($model,'wikiBookId',WikiBook::model()->selectOptions,array('empty'=>Yii::t('site','(Select)'))); ?>
        <?php echo $form->error($model,'wikiBookId'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'content'); ?>
        <?php //echo CHtml::activeTextArea($model,'content',array('rows'=>10, 'cols'=>70)); ?>
        <?php $this->widget(
            'application.extensions.ddeditor.DDEditor',
            array(
                'model'=>$model,
                'attribute'=>'content',
                'htmlOptions'=>array('rows'=>10, 'cols'=>70),
                'previewRequest'=>'wikiPage/preview',
                'additionalSnippets'=>array(
                    Yii::t('site','Icons')=>array(
                        '_ICON_NEW_'=>Yii::t('site','New'),
                        '_ICON_EDIT_'=>Yii::t('site','Edit'),
                        '_ICON_VIEW_'=>Yii::t('site','View'),
                        '_ICON_DELETE_'=>Yii::t('site','Delete'),
                    )
                ),
            )); ?>
        <p class="hint">You may use <a target="_blank" href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a>.</p>
        <?php echo $form->error($model,'content'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'tags'); ?>
        <?php $this->widget('CAutoComplete', array(
            'model'=>$model,
            'attribute'=>'tags',
            'url'=>array('suggestTags'),
            'multiple'=>true,
            'htmlOptions'=>array('size'=>50),
        )); ?>
        <p class="hint"><?php echo CHtml::encode(Yii::t('site','Please separate different tags with commas.')); ?></p>
        <?php echo $form->error($model,'tags'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'status'); ?>
        <?php echo $form->dropDownList($model,'status',Lookup::items('PostStatus')); ?>
        <?php echo $form->error($model,'status'); ?>
    </div>

    <div class="row">
        <?php echo CHtml::label(Yii::t('site','Save item as new'),'saveAsNew'); ?>
        <?php echo CHtml::checkBox('saveAsNew',0); ?>
    </div>

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? Yii::t('site','Create') : Yii::t('site','Save')); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
<script type="text/javascript">
<!--
jQuery('#Post_title').focus().select();
// -->
</script>
